<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
           //\w 数字 字母 下划线  
           let name="sa232as_唐玮\n";
           console.log(name.match(/\w+/g));//['sa232as_']

           //\W 除了数字字母下划线
           console.log(name.match(/\W+/g));//['唐玮\n']
           console.log(name.match(/[^\w]+/g));//['唐玮\n']
    </script>
</body>
</html>